﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:js="urn:extra-functions">
    <xsl:output method="html" indent="yes"/>
    <xsl:template match="object">
            <html>
                <head>
                    <title>Invoice</title>
                    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
                </head>
                <body>
                <table >
                    <xsl:for-each select="properties/*">
                            <xsl:choose>
                                <xsl:when test="@name[contains(., 'curveXishuList')]">
                                    <tr>
                                        <td>
                                            <xsl:value-of select="@name" />
                                        </td>
                                        <td>
                                            <table>
                                            <xsl:for-each select="items/*">
                                                <tr>
                                                <td>
                                                <xsl:value-of select="@name" />
                                                </td>
                                                <td>
                                                    <table>
                                                    <xsl:for-each select="properties/*">
                                                        <tr>
                                                            <td>
                                                            <xsl:value-of select="@name" />
                                                            </td>
                                                            <td>
                                                            <xsl:value-of select="." />
                                                            </td>
                                                        </tr>
                                                    </xsl:for-each>
                                                    </table>
                                                </td>
                                                </tr>
                                            </xsl:for-each>
                                            </table>
                                        </td>
                                    </tr>
                                </xsl:when>
                                <xsl:otherwise>
                                    <tr>
                                        <td >
                                            <xsl:value-of select="@name" />
                                        </td>
                                        <td  >
                                            <xsl:value-of select="." />
                                        </td>
                                    </tr>
                                </xsl:otherwise>
                            </xsl:choose>
                    </xsl:for-each>
                </table>
                </body>
            </html>
        </xsl:template>
    <!-- variable ReportHeader-->
    <xsl:variable name="ReportHeader">
                    <h3 style="color:darkblue; font-family: Arial;">分析方法</h3>
    </xsl:variable>

    <!-- variable OrderRecipient-->
    <xsl:variable name="OrderRecipient">
    </xsl:variable>
    <!-- variable OrderHeader-->
    <xsl:variable name="OrderHeader">
    </xsl:variable>

    <!-- variable ReportFooter-->
    <xsl:variable name="ReportFooter">
        <table class="tableReportFooter">
            <tr>
                <td style="width:20px;"></td>
                <td>
                    <table>
                        <tr>
                            <td style="font-size: 5pt; text-align: justify;border-top: solid DarkBlue 1px;">
                                One Portals Way, Twin Points WA  98156 Phone: 1-206-555-1417   Fax: 1-206-555-5938
                            </td>
                        </tr>
                    </table>
                </td>
                <td style="width:20px;"></td>
            </tr>
        </table>
    </xsl:variable>

    <!-- Template Filler-->
    <xsl:template name="Filler">
        <xsl:param name="fillercount" select="1"/>
        <xsl:if test="$fillercount > 0">
            <table class="tabledetails">
                <tr>
                    <td>
                        <xsl:value-of select="translate(' ', ' ', '&#160;')"/>
                    </td>
                </tr>
            </table>
            <xsl:call-template name="Filler">
                <xsl:with-param name="fillercount" select="$fillercount - 1"/>
            </xsl:call-template>
        </xsl:if>
    </xsl:template>

    <!--variable OrderRowsHeader-->
    <xsl:variable name="OrderRowsHeader">
        <table class="tabledetails" cellspacing="0" style="table-layout:fixed">
            <tr>
                <th style="width:170px">
                    Name:
                </th>
                <th style="width:220px">
                    Value:
                </th>
            </tr>
        </table>
    </xsl:variable>

    <!--variable OrderTotals-->
    <xsl:variable name="OrderTotals">
        <table class="tabledetails" cellspacing="0" style="table-layout:fixed">
            <tr>
                <td class="tdtotalmargin" />
                <td class="documenttotal" align="right">
                    Subtotal:
                </td>
                <td class="blueline" align="right">
                    <xsl:value-of select="/Data/Order/SubTotal" />
                    <xsl:value-of select="translate(' ', ' ', '&#160;')"/>
                </td>
                <td class="tdmargin" />
            </tr>
            <tr>
                <td class="tdtotalmargin" />
                <td class="documenttotal" align="right">
                    Freight:
                </td>
                <td class="blueline" align="right">
                    <xsl:value-of select="/Data/Order/Freight" />
                    <xsl:value-of select="translate(' ', ' ', '&#160;')"/>
                </td>
                <td class="tdmargin" />
            </tr>
            <tr>
                <td class="tdtotalmargin" />
                <td class="documenttotal" align="right">
                    Total:
                </td>
                <td class="blueline"  align="right">
                    <xsl:value-of select="/Data/Order/Total" />
                    <xsl:value-of select="translate(' ', ' ', '&#160;')"/>
                </td>
                <td class="tdmargin" />
            </tr>
        </table>
    </xsl:variable>

</xsl:stylesheet>
